package com.mars.java8;

import com.mars.btrace.pojo.User;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * author by: mars
 * Date: 2019/5/26 22:43
 * Description: List的stream的filter用法
 */
public class ListDemo1 {

    public static void main(String[] args) {

        List<User> userList = new ArrayList<>();
        userList.add(new User(1,"mars1","WOMEN"));
        userList.add(new User(1,"mars2","MEN"));
        userList.add(new User(1,"kaven1","WOMEN"));
        userList.add(new User(1,"kaven2","MEN"));

        userList.get(0).setName("aaa");

        System.out.println(userList.get(0).getName());

//        List<User> result = userList.stream().filter(u-> "MEN".equals(u.getSex())).collect(Collectors.toList());
//        System.out.println(userList);
//        System.out.println("================");
//        System.out.println(result);


    }
}
